SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

# include_directories(/usr/local/include)
# link_directories(/usr/local/lib)

add_executable(curltest main.c)
# target_link_libraries(curltest curl)

# 每一个模块都会定义以下几个变量
# <name>_FOUND
# <name>_INCLUDE_DIR or <name>_INCLUDES
# <name>_LIBRARY ro <name>_LIBARIES
find_package(CURL)
if(CURL_FOUND)
    include_directories(${CURL_INCLUDE_DIR})
    target_link_libraries(curltest ${CURL_LIBRARY})
    message(STATUS "-----> CURL_INCLUDE_DIR: " ${CURL_INCLUDE_DIR})
    message(STATUS "-----> CURL_LIBRARY: " ${CURL_LIBRARY})
else(CURL_FOUND)
    message(FATAL_ERROR "CURL library not found")
endif(CURL_FOUND)

